<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>12311</div>
    <button id="btn">点击</button>
</body>
<script>
    //防抖节流
    // 节流
 function throttle(fn,wait) {
     let previous = 0;
     return function () {
         let context = this;
         let args = arguments;
         let now = + new Date();
         if(now-previous>wait){
             fn.apply(context,args);
                previous = now;
         }
     }
 }
    document.querySelector('#btn').onclick = throttle((arg) => {
        console.log(arg)
    }, 2000).bind(document.querySelector('#btn'), '123')  //使用bind传参
</script>

</html>